package com.jeeplus.test.jlnu.student.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jeeplus.test.jlnu.student.domain.entity.BkStudentFamily;
import com.jeeplus.test.jlnu.student.domain.entity.BkbsssStudentPrize;
import com.jeeplus.test.jlnu.student.domain.vo.BkStudentFamilyReqVo;
import com.jeeplus.test.jlnu.student.mapper.BkStudentFamilyMapper;
import com.jeeplus.test.jlnu.student.mapper.BkbsssStudentPrizeMapper;
import com.jeeplus.test.jlnu.student.service.BkStudentFamilyService;
import com.jeeplus.test.jlnu.student.service.BkbsssStudentPrizeService;
import com.jeeplus.test.tools.resp.Convert2Bean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BkStudentFamilyServiceImpl extends ServiceImpl<BkStudentFamilyMapper, BkStudentFamily> implements BkStudentFamilyService {
    @Autowired
    private  BkStudentFamilyMapper bkStudentFamilyMapper;

    @Override
    public BkStudentFamily getBkStudentFamily(String studentId) {
        LambdaQueryChainWrapper<BkStudentFamily> wrapper = new LambdaQueryChainWrapper<>(bkStudentFamilyMapper);
        wrapper.eq(BkStudentFamily::getStudentId, studentId);
        return wrapper.one();
    }

    @Override
    public Boolean bkStudentFamilyUpdate(BkStudentFamily bkStudentFamily) {
        LambdaUpdateChainWrapper<BkStudentFamily> wrapper = new LambdaUpdateChainWrapper<>(bkStudentFamilyMapper);
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember1Name())){
            wrapper.set(BkStudentFamily::getFamilyMember1Name,bkStudentFamily.getFamilyMember1Name());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember1Relation())){
            wrapper.set(BkStudentFamily::getFamilyMember1Relation,bkStudentFamily.getFamilyMember1Relation());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember1Relationship())){
            wrapper.set(BkStudentFamily::getFamilyMember1Relationship,bkStudentFamily.getFamilyMember1Relationship());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember1WorkUnit())){
            wrapper.set(BkStudentFamily::getFamilyMember1WorkUnit,bkStudentFamily.getFamilyMember1WorkUnit());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember1Position())){
            wrapper.set(BkStudentFamily::getFamilyMember1Position,bkStudentFamily.getFamilyMember1Position());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember1Phone())){
            wrapper.set(BkStudentFamily::getFamilyMember1Phone,bkStudentFamily.getFamilyMember1Phone());
        }

        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember2Name())){
            wrapper.set(BkStudentFamily::getFamilyMember2Name,bkStudentFamily.getFamilyMember2Name());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember2Relation())){
            wrapper.set(BkStudentFamily::getFamilyMember2Relation,bkStudentFamily.getFamilyMember2Relation());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember2Relationship())){
            wrapper.set(BkStudentFamily::getFamilyMember2Relationship,bkStudentFamily.getFamilyMember2Relationship());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember2WorkUnit())){
            wrapper.set(BkStudentFamily::getFamilyMember2WorkUnit,bkStudentFamily.getFamilyMember2WorkUnit());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember2Position())){
            wrapper.set(BkStudentFamily::getFamilyMember2Position,bkStudentFamily.getFamilyMember2Position());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember2Phone())){
            wrapper.set(BkStudentFamily::getFamilyMember2Phone,bkStudentFamily.getFamilyMember2Phone());
        }

        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember3Name())){
            wrapper.set(BkStudentFamily::getFamilyMember3Name,bkStudentFamily.getFamilyMember3Name());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember3Relation())){
            wrapper.set(BkStudentFamily::getFamilyMember3Relation,bkStudentFamily.getFamilyMember3Relation());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember3Relationship())){
            wrapper.set(BkStudentFamily::getFamilyMember3Relationship,bkStudentFamily.getFamilyMember3Relationship());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember3WorkUnit())){
            wrapper.set(BkStudentFamily::getFamilyMember3WorkUnit,bkStudentFamily.getFamilyMember3WorkUnit());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember3Position())){
            wrapper.set(BkStudentFamily::getFamilyMember3Position,bkStudentFamily.getFamilyMember3Position());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember3Phone())){
            wrapper.set(BkStudentFamily::getFamilyMember3Phone,bkStudentFamily.getFamilyMember3Phone());
        }

        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember4Name())){
            wrapper.set(BkStudentFamily::getFamilyMember4Name,bkStudentFamily.getFamilyMember4Name());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember4Relation())){
            wrapper.set(BkStudentFamily::getFamilyMember4Relation,bkStudentFamily.getFamilyMember4Relation());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember4Relationship())){
            wrapper.set(BkStudentFamily::getFamilyMember4Relationship,bkStudentFamily.getFamilyMember4Relationship());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember4WorkUnit())){
            wrapper.set(BkStudentFamily::getFamilyMember4WorkUnit,bkStudentFamily.getFamilyMember4WorkUnit());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember4Position())){
            wrapper.set(BkStudentFamily::getFamilyMember4Position,bkStudentFamily.getFamilyMember4Position());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember4Phone())){
            wrapper.set(BkStudentFamily::getFamilyMember4Phone,bkStudentFamily.getFamilyMember4Phone());
        }

        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember5Name())){
            wrapper.set(BkStudentFamily::getFamilyMember5Name,bkStudentFamily.getFamilyMember5Name());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember5Relation())){
            wrapper.set(BkStudentFamily::getFamilyMember5Relation,bkStudentFamily.getFamilyMember5Relation());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember5Relationship())){
            wrapper.set(BkStudentFamily::getFamilyMember5Relationship,bkStudentFamily.getFamilyMember5Relationship());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember5WorkUnit())){
            wrapper.set(BkStudentFamily::getFamilyMember5WorkUnit,bkStudentFamily.getFamilyMember5WorkUnit());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember5Position())){
            wrapper.set(BkStudentFamily::getFamilyMember5Position,bkStudentFamily.getFamilyMember5Position());
        }
        if (ObjectUtil.isNotEmpty(bkStudentFamily.getFamilyMember5Phone())){
            wrapper.set(BkStudentFamily::getFamilyMember5Phone,bkStudentFamily.getFamilyMember5Phone());
        }
        //根据id修改
        wrapper.eq(BkStudentFamily::getId, bkStudentFamily.getId());
        return wrapper.update();
    }
}
